#!/bin/bash
#
#
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
#
# SPDX-License-Identifier: BSD-2-Clause
#

set -e
echo 'running run_tests script'

# Fetch directory this script is stored in.
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"

# Run the tests from the script directory.
cd ${DIR}
mkdir -p .junit-reports

if (($# >= 0)) && [[ $1 == "--prepared-target" ]]; then
    TESTDIR=./graph-refine-internal
else
    TESTDIR=./
fi

echo "TESTDIR="$TESTDIR

python ../l4v/misc/regression/run_tests.py --junit-report=.junit-reports/regression.xml --d $TESTDIR

# JUnit parser requires class names
sed -i -e 's/<testcase classname=""/<testcase classname="wcet_regression"/g' .junit-reports/regression.xml


